Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a converter specified shortcut #625

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Add a converter specified shortcut #625

merged 2 commits into from
Sep 16, 2024

Conversation

noborus
Copy link
Owner

@noborus noborus commented Sep 12, 2024

Add a shortcut specified by RAW and Align converter.

Add a shortcut specified by RAW and Align Concverter.
@ccoVeille
Copy link
Contributor

Is concverter a real thing or a typo ?

Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cobra is powerful framework, I'm surprised you have to do this

Comment on lines 709 to 714
if RawF {
root.General.Converter = convRaw
}
if AlignF {
root.General.Converter = convAlign
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is strange to read.

So AlignF "wins" vs RawF when present, right?

Maybe this?

Suggested change
if RawF {
root.General.Converter = convRaw
}
if AlignF {
root.General.Converter = convAlign
}
if AlignF {
root.General.Converter = convAlign
} else if RawF {
root.General.Converter = convRaw
}

Comment on lines 376 to 380
// RawF is specifies converter shortcut for raw.
var RawF bool

// AlignF is specifies converter shortcut for align.
var AlignF bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RawF is specifies converter shortcut for raw.
var RawF bool
// AlignF is specifies converter shortcut for align.
var AlignF bool
// RawF specifies converter shortcut for raw.
var RawF bool
// AlignF specifies converter shortcut for align.
var AlignF bool

Comment on lines 376 to 380
// RawF is specifies converter shortcut for raw.
var RawF bool

// AlignF is specifies converter shortcut for align.
var AlignF bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need tgem to be exported

Comment on lines 709 to 714
if RawF {
root.General.Converter = convRaw
}
if AlignF {
root.General.Converter = convAlign
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe using

https://pkg.go.dev/github.com/spf13/pflag#Set

So set the converter flag?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comment.
I moved to the main side and fixed it.

@noborus
Copy link
Owner Author

noborus commented Sep 12, 2024

Is concverter a real thing or a typo ?

Typo. I will fix it.

@noborus noborus changed the title Add a concverter specified shortcut Add a converter specified shortcut Sep 12, 2024
Transferred shortcut handling for align and raw
from oviewer/oviewer.go to main.go.
@noborus noborus merged commit f373308 into master Sep 16, 2024
8 checks passed
@noborus noborus deleted the add-shortcut-option branch October 30, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants